package com.teradyne.merlin2.ui.client.views;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.teradyne.merlin2.ui.client.resources.MerlinStyle;

public class OrderMenuViewImpl extends Composite implements OrderMenuView {

	private static OrderMenuViewImplUiBinder uiBinder = GWT.create(OrderMenuViewImplUiBinder.class);

	interface OrderMenuViewImplUiBinder extends UiBinder<Widget, OrderMenuViewImpl> {
	}

	@UiField
	Anchor ancOrderList;

	@UiField
	Anchor ancOrderEntry;

	@UiField
	Anchor ancOrderHistory;

	private Presenter presenter;
	private MerlinStyle merlinStyle;

	/**
	 * 
	 * @param merlinStyle
	 *            - inject by gin for ensuring that the Merlin Style was
	 *            initialized
	 */

	@Inject
	public OrderMenuViewImpl(MerlinStyle merlinStyle) {
		this.merlinStyle = merlinStyle;
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;

	}

	@UiHandler("ancOrderList")
	void onOrderListClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onOrderListClicked();
		}
	}
	
	@UiHandler("ancOrderEntry")
	void onOrderEntryClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onOrderEntryClicked();
		}
	}
	
	@UiHandler("ancOrderHistory")
	void onOrderHistoryClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onOrderHistoryClicked();
		}
	}

	// @Override
	// public HasClickHandlers getHandlerOrderList() {
	// return ancOrderList;
	// }
	//
	// @Override
	// public HasClickHandlers getHandlerOrderEntry() {
	// return ancOrderEntry;
	// }
	//
	// @Override
	// public HasClickHandlers getHandlerOrderHistory() {
	// return ancOrderHistory;
	// }

}
